using {MainService} from '../srv/main-service';

annotate MainService.RootCertificateAuthoritys with @odata.draft.enabled;

annotate MainService.RootCertificateAuthoritys with {
    ID                   @UI    : {Hidden : true};
    alias                @title : 'Alias';
    countryName          @title : 'Country Name';
    stateName            @title : 'State Name';
    localityName         @title : 'Locality Name';
    organizationName     @title : 'Organization Name';
    organizationUnitName @title : 'Organizational Unit Name';
    commonName           @title : 'Common Name';
    emailAddress         @title : 'Email Address';
};

annotate MainService.RootCertificateAuthoritys with @(UI : {
    SelectionFields     : [
        alias,
        createdAt,
        createdBy
    ],
    LineItem            : [
        {Value : alias},
        {Value : countryName},
        {Value : stateName},
        {Value : localityName},
        {Value : organizationName},
        {Value : organizationUnitName},
        {Value : commonName},
        {Value : emailAddress},
        {
            $Type   : 'UI.DataFieldForAction',
            Label   : 'Test Action',
            Action  : 'MainService.testActionItem',
            Inline  : true,
            IconUrl : 'sap-icon://action'
        }
    ],
    HeaderInfo          : {
        TypeName       : 'Root CA Certificate',
        TypeNamePlural : 'Root CA Certificates',
        Title          : {
            Label : 'Root CA Certificate Alias ', //A label is possible but it is not considered on the ObjectPage yet
            Value : ID
        },
        Description    : {
            Value : alias,
            Label : 'Alias for identifying in CA management tool'
        }
    },
    Facets              : [{
        $Type  : 'UI.ReferenceFacet',
        Label  : 'General Information',
        Target : '@UI.FieldGroup#General'
    }],
    FieldGroup #General : {Data : [
        {
            Value : countryName,
            Label : 'Country Name (2 letter code)[AU]'
        },
        {
            Value : stateName,
            Label : 'State or Province Name (full name) [Some-State]'
        },
        {
            Value : localityName,
            Label : 'Locality Name (eg, city) []'
        },
        {
            Value : organizationName,
            Label : 'Organization Name (eg, company) [Internet Widgits Pty Ltd]'
        },
        {
            Value : organizationUnitName,
            Label : 'Organizational Unit Name (eg, section) []'
        },
        {
            Value : commonName,
            Label : 'Common Name (e.g. server FQDN or YOUR name) []'
        },
        {
            Value : emailAddress,
            Label : 'Email Address []'
        }
    ]}
});
